package com.baseweb.webadmin.service.impl;


import com.baseweb.webadmin.core.model.bvo.*;
import com.baseweb.webadmin.core.model.dao.UserDao;
import com.baseweb.webadmin.core.model.mapper.*;
import com.baseweb.webadmin.core.model.pojo.*;
import com.baseweb.webadmin.core.util.RequestPage;
import com.baseweb.webadmin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private UserRoleMapper userRoleMapper;
    @Autowired
    private ByOpenCityMapper byOpenCityMapper;
    @Autowired
    private ByUserBizAuthMapper byUserBizAuthMapper;
    @Autowired
    private ByChannelKeywordMapper byChannelKeywordMapper;
    @Autowired
    private RescMapper rescMapper;
    @Autowired
    private ByUserRecommendMapper byUserRecommendMapper;
    @Autowired
    private ByUserBizScheduleMapper byUserBizScheduleMapper;
    @Autowired
    private ByMoneyLogMapper byMoneyLogMapper;

    @Override
    public User selectByName(String username) {
        return userDao.selectUserByUserName(username);
    }

    @Override
    public User selectUserByToken(String token) {
        return userDao.selectUserByToken(token);
    }

    @Override
    public List<User> selectUserByIds(List<Integer> ids) {
        return userDao.selectUserByIds(ids);
    }

    @Override
    public List<User> selectUsers(String username) {
        return userDao.selectUsers(username);
    }

    @Override
    public User selectUserById(Integer userid) {
        return userDao.selectUserById(userid);
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public List<UserRoleBvo> selectUsersByPage(int pageNo, int pageSize, Map map) {
        if (pageNo < 1) {
            pageNo = 1;
        }

        if (pageSize < 1) {
            pageSize = 20;
        }

        int startCount = (pageNo - 1) * pageSize;
        map.put("startCount", startCount);
        map.put("pageSize", pageSize);

        return userDao.selectUsersByPage(map);
    }

    @Override
    public Integer getRowsByName(Map map) {
        return userDao.selectUsersByNameRows(map);
    }

    @Override
    public int deleteUserRoleByRoleId(Integer roleId) {
        UserRoleExample userRoleExample = new UserRoleExample();
        userRoleExample.createCriteria().andRoleIdEqualTo(roleId);
        return userRoleMapper.deleteByExample(userRoleExample);
    }

    @Override
    public int deleteUserRoleByUserId(Integer userId) {
        UserRoleExample userRoleExample = new UserRoleExample();
        userRoleExample.createCriteria().andUserIdEqualTo(userId);
        return userRoleMapper.deleteByExample(userRoleExample);
    }

    /**
     * 批量删除user_role更加用户id和角色id
     *
     * @param userRoleKeyList
     */
    @Override
    public void deleteUserRoleByUserRoleKey(List<UserRoleKey> userRoleKeyList) {
        UserRoleExample userRoleExample = null;
        for (UserRoleKey userRoleKey : userRoleKeyList) {
            userRoleExample = new UserRoleExample();
            userRoleExample.createCriteria().andUserIdEqualTo(userRoleKey.getUserId());
            userRoleExample.createCriteria().andRoleIdEqualTo(userRoleKey.getRoleId());
            userRoleMapper.deleteByExample(userRoleExample);
        }
    }

    @Override
    public int deleteUserById(Integer userId) {
        UserExample userExample = new UserExample();
        userExample.createCriteria().andIdEqualTo(userId);
        return userMapper.deleteByExample(userExample);
    }

    /**
     * 验证用户名似否已被使用
     *
     * @param userName
     * @return
     */
    @Override
    public boolean verifyUserName(String userName) {
        if (null != userDao.selectUserByUserName(userName)) {
            return true;
        }
        return false;
    }


    /**
     * 验证邮箱似否已被使用
     *
     * @param email
     * @return
     */
    @Override
    public boolean verifyEmail(String email) {
        boolean flag = false;
        List<User> _userList = userDao.selectUserByEmail(email);
        if (null != _userList && _userList.size() > 0) {
            flag = true;
        }
        if (flag == true) {
            return true;
        }
        return false;
    }

    @Override
    public List<User> selectUserByUserType(Integer userType, Integer status) {
        return userDao.selectUserByUserType(userType, status);
    }

    @Override
    public List<User> selectAgentUserList(Integer agentId, Integer status, String cn_name, String username, String identity, Integer start, Integer offset) {
        return userDao.selectAgentUserList(agentId, status, cn_name, username, identity,start,offset);
    }

    @Override
    public Integer selectAgentUserListCount(Integer agentId, Integer status, String cn_name, String username, String identity) {
        return userDao.selectAgentUserListCount(agentId, status, cn_name, username, identity);
    }

    @Override
    public User selectUserByWxId(String openId, String unionId) {
        return userDao.selectUserByWxId(openId, unionId);
    }

    public int updateByPrimaryKey(User record) {
        return userMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<User> selectUserListByPage(Integer id, String username, Integer start, Integer offset) {
        return userDao.selectUserListByPage(id, username, start, offset);
    }

    @Override
    public Integer selectUserListCount(Integer id, String username) {
        return userDao.selectUserListCount(id, username);
    }

    @Override
    public List<User> selectUserListByTypeAndPage(Integer user_type, Integer start, Integer offset) {
        return userDao.selectUserListByTypeAndPage(user_type, start, offset);
    }

    @Override
    public Integer selectUserListByTypeCount(Integer user_type) {
        return userDao.selectUserListByTypeCount(user_type);
    }

    @Override
    public Integer insertBizVerify(ByUserBizAuth byUserBizAuth) {
        return userDao.insertBizVerify(byUserBizAuth);
    }

    @Override
    public ByUserBizAuth findBizVerify(Integer id) {
        return userDao.findBizVerify(id);
    }

    @Override
    public List<ByUserBizAuth> selectBizVerifyListByPage(Integer userId, Integer authType, String name, Integer start, Integer offset) {
        return userDao.selectBizVerifyListByPage(userId, authType, name, start, offset, null);
    }
    @Override
    public List<ByUserBizAuthvo> selectBizVerifyListByPage1(ByUserBizAuthvo auth, Integer start, Integer offset) {
        return userDao.selectBizVerifyListByPage1(auth, start, offset);
    }
    @Override
    public Integer selectBizVerifyListCount(Integer userId, Integer authType, String name) {
        return userDao.selectBizVerifyListCount(userId, authType, name, null);
    }
    @Override
    public Integer selectBizVerifyListCount1(ByUserBizAuthvo auth) {
        return userDao.selectBizVerifyListCount1(auth);
    }

    @Override
    public List<ByUserBizAuth> selectBizVerifyListByPage(Integer userId, Integer authType, String name, Integer start, Integer offset, Integer status) {
        return userDao.selectBizVerifyListByPage(userId, authType, name, start, offset, status);
    }

    @Override
    public Integer selectBizVerifyListCount(Integer userId, Integer authType, String name, Integer status) {
        return userDao.selectBizVerifyListCount(userId, authType, name, status);
    }

    @Override
    public List<UserVerifyBvo> selectBizVerifyStatusList(List<Integer> userId, Integer status) {
        return userDao.selectBizVerifyStatusList(userId, status);
    }
    @Override
    public List<ByUserBizAuth> selectBizVerifyStatusList1(Integer userId ) {
        return userDao.selectBizVerifyStatusList1(userId);
    }

    @Override
    public List<ByUserBizPackage> selectPackageListByPage(Integer userId, String name, Integer start, Integer offset) {
        return userDao.selectPackageListByPage(userId, name, start, offset);
    }

    @Override
    public Integer selectPackageListCount(Integer userId, String name) {
        return userDao.selectPackageListCount(userId, name);
    }

    @Override
    public List<ByUserBizPackageDetail> selectPackageDetailListByPage(Integer userId, Integer packageId, Integer productId, Integer start, Integer offset) {
        return userDao.selectPackageDetailListByPage(userId, packageId, productId, start, offset);
    }

    @Override
    public Integer selectPackageDetailListCount(Integer userId, Integer packageId, Integer productId) {
        return userDao.selectPackageDetailListCount(userId, packageId, productId);
    }

    @Override
    public Integer insertBizPackage(ByUserBizPackage byUserBizPackage) {
        return userDao.insertBizPackage(byUserBizPackage);
    }

    @Override
    public ByUserBizPackage findBizPackage(Integer id) {
        return userDao.findBizPackage(id);
    }

    @Override
    public Integer insertBizPackageDetail(ByUserBizPackageDetail byUserBizPackageDetail) {
        return userDao.insertBizPackageDetail(byUserBizPackageDetail);
    }

    @Override
    public ByUserBizPackageDetail findBizPackageDetail(Integer id) {
        return userDao.findBizPackageDetail(id);
    }

    @Override
    public Integer insertBizProduct(ByUserBizProduct byUserBizProduct) {
        return userDao.insertBizProduct(byUserBizProduct);
    }

    @Override
    public ByUserBizProduct findBizProduct(Integer id) {
        return userDao.findBizProduct(id);
    }

    @Override
    public List<ByUserBizProduct> findBizProductList(List<Integer> ids) {
        return userDao.findBizProductList(ids);
    }

    @Override
    public List<ByUserBizProduct> selectProductListByPage(Integer userId, Integer productType, Integer channelId, Integer start, Integer offset,
                                                          String sortBy, String styleType, String price, String keyword) {
        return userDao.selectProductListByPage(userId, productType, channelId, start, offset, sortBy, styleType, price, keyword, null);
    }

    @Override
    public List<ByUserBizProductBvo> selectProductVoListByPage(Integer userId, String userName, String userMobile, String userChannel, String keyword,
                                                               Integer auditType, Integer status, String startTime, String endTime,
                                                               String province, String city, String county, Integer start, Integer offset) {
        return userDao.selectProductVoListByPage(userId, userName, userMobile, userChannel, keyword, auditType, status, startTime, endTime, province, city, county, start,offset);
    }

    @Override
    public List<ByUserBizProductBvo> selectProductVoListByPage(String userName, String userMobile, Integer userChannel, String keyword,
                                                               Integer auditType, Integer status, String startTime, String endTime,
                                                               String province, String city, String county, Integer start, Integer offset) {
        return userDao.selectProductVoListByPage(userName, userMobile, userChannel, keyword, auditType, status, startTime, endTime, province, city, county, start, offset);
    }

    @Override
    public Integer selectProductListCount(Integer userId, Integer productType, Integer channelId,
                                          String sortBy, String styleType, String price, String keyword) {
        return userDao.selectProductListCount(userId, productType, channelId, sortBy, styleType, price, keyword, null);
    }

    @Override
    public Integer selectProductListCount(String userName, String userMobile, String userChannel, String keyword,
                                          Integer auditType, Integer status, String startTime, String endTime,
                                          String province, String city, String county) {
        return userDao.selectProductListCount(userName, userMobile, userChannel, keyword, auditType, status, startTime, endTime, province, city, county);
    }

    @Override
    public List<ByUserBizProduct> selectProductListByPage(Integer userId, Integer productType, Integer channelId, Integer start, Integer offset,
                                                          String sortBy, String styleType, String price, String keyword, Integer status) {
        return userDao.selectProductListByPage(userId, productType, channelId, start, offset, sortBy, styleType, price, keyword, status);
    }

    @Override
    public Integer selectProductListCount(Integer userId, Integer productType, Integer channelId, String sortBy, String styleType, String price, String keyword, Integer status) {
        return userDao.selectProductListCount(userId, productType, channelId, sortBy, styleType, price, keyword, status);
    }

    @Override
    public Integer insertOpenCity(ByOpenCity byOpenCity) {
        return userDao.insertOpenCity(byOpenCity);
    }

    @Override
    public ByOpenCity findOpenCity(Integer id) {
        return userDao.findOpenCity(id);
    }

    @Override
    public Integer deleteOpenCity(Integer id) {
        return userDao.deleteOpenCity(id);
    }

    @Override
    public List<ByOpenCity> selectOpenCityListByPage(Integer userId, Integer openType, String province, Integer start, Integer offset) {
        return userDao.selectOpenCityListByPage(userId, openType, province, start, offset);
    }

    @Override
    public Integer selectOpenCityListCount(Integer userId, Integer openType, String province) {
        return userDao.selectOpenCityListCount(userId, openType, province);
    }

    @Override
    public List<Map> selectAllCities() {
        List<Map> result = new ArrayList<Map>();
        List<ByOpenCity> cities = userDao.selectAllCities(null);
        Set set = new HashSet();
        if (cities != null && cities.size() > 0){
            for (ByOpenCity current : cities){
                set.add(current.getCity());
            }
            for(Iterator it = set.iterator();  it.hasNext();){
                Map<String, String> map = new HashMap<String, String>();
                map.put("name", it.next().toString());
                result.add(map);
            }
        }

        return result;
    }

    @Override
    public List<String> selectAllCitiesList() {
        List<String> result = new ArrayList<String>();
        List<ByOpenCity> cities = userDao.selectAllCities(null);
        if (cities != null && cities.size() > 0){
            Set set = new HashSet();
            for (ByOpenCity current : cities){
                set.add(current.getCity());
            }
            result.addAll(set);
        }

        return result;
    }

    @Override
    public List<ByOpenCity> selectAllCitiesObjectList(Integer userId) {
        List<ByOpenCity> result = new ArrayList<ByOpenCity>();
        List<ByOpenCity> cities = userDao.selectAllCities(userId);
        if (cities != null && cities.size() > 0){
            Set set = new HashSet();
            for (ByOpenCity current : cities){
                if (!set.contains(current.getCity())){
                    set.add(current.getCity());
                    result.add(current);
                }
            }
        }

        return result;
    }

    @Override
    public List<ByUserTrolley> selectTrolleyListByPage(Integer userId, Integer start, Integer offset) {
        return userDao.selectTrolleyListByPage(userId, start, offset);
    }

    @Override
    public Integer selectTrolleyListCount(Integer userId) {
        return userDao.selectTrolleyListCount(userId);
    }

    @Override
    public Integer insertTrolley(ByUserTrolley byUserTrolley) {
        return userDao.insertTrolley(byUserTrolley);
    }

    @Override
    public ByUserTrolley findTrolley(Integer id) {
        return userDao.findTrolley(id);
    }

    @Override
    public ByUserTrolley findTrolleyByUserAndProduct(Integer userId, Integer productId) {
        return userDao.findTrolleyByUserAndProduct(userId, productId);
    }

    @Override
    public List<ByUserTrolleyBvo> selectByUserTrolleyList(Integer userId) {
        return userDao.selectByUserTrolleyList(userId);
    }

    @Override
    public List<ByUserBizProduct> selectTrolleyProductListByPage(Integer userId, Integer start, Integer offset) {
        return userDao.selectTrolleyProductListByPage(userId, start, offset);
    }

    @Override
    public Integer selectTrolleyProductListCount(Integer userId) {
        return userDao.selectTrolleyProductListCount(userId);
    }

    @Override
    public Integer deleteTrolley(Integer id) {
        return userDao.deleteTrolley(id);
    }

    @Override
    public Integer deleteTrolleyByUserAndProduct(Integer userId, List<Integer> productIds) {
        return userDao.deleteTrolleyByUserAndProduct(userId, productIds);
    }

    @Override
    public Integer insertInvite(ByUserInvite byUserInvite) {
        return userDao.insertInvite(byUserInvite);
    }

    @Override
    public ByUserInvite findInvite(Integer id) {
        return userDao.findInvite(id);
    }

    @Override
    public ByUserInvite findInviteBy(Integer userId) {
        return userDao.findInviteBy(userId);
    }

    @Override
    public List<ByUserInvite> selectInviteListByPage(Integer userId, Integer inviteBy, Integer start, Integer offset) {
        return userDao.selectInviteListByPage(userId, inviteBy, start, offset);
    }

    @Override
    public Integer selectInviteListCount(Integer userId, Integer inviteBy) {
        return userDao.selectInviteListCount(userId, inviteBy);
    }

    @Override
    public Integer insertBudget(ByUserWedBudget byUserWedBudget) {
        return userDao.insertBudget(byUserWedBudget);
    }

    @Override
    public ByUserWedBudget findBudget(Integer id) {
        return userDao.findBudget(id);
    }

    @Override
    public List<ByUserWedBudget> selectBudgetListByPage(Integer userId, Integer start, Integer offset) {
        return userDao.selectBudgetListByPage(userId, start, offset);
    }
    @Override
    public List<ByUserWedBudget> selectIntentCustomListByPage(ByUserWedBudget custom, Integer start, Integer offset) {
        return userDao.selectIntentCustomListByPage(custom, start, offset);
    }
    @Override
    public Integer selectBudgetListCount(Integer userId) {
        return userDao.selectBudgetListCount(userId);
    }
    @Override
    public Integer selectIntentCustomListCount(ByUserWedBudget custom) {
        return userDao.selectIntentCustomListCount(custom);
    }
    @Override
    public Integer insertExample(ByUserExample byUserExample) {
        return userDao.insertExample(byUserExample);
    }

    @Override
    public ByUserExample findExample(Integer id) {
        return userDao.findExample(id);
    }

    @Override
    public Integer deleteExample(Integer id) {
        return userDao.deleteExample(id);
    }

    @Override
    public List<ByUserExample> selectExampleListByPage(Integer userId, Integer status, Integer exampleType, Integer start, Integer offset) {
        return userDao.selectExampleListByPage(userId, status, exampleType, start, offset);
    }

    @Override
    public List<ByUserExampleBvo> selectExampleBvoListByPage(ByUserExampleBvo exampleBvo, RequestPage requestPage) {
        return userDao.selectExampleBvoListByPage(exampleBvo,requestPage);
    }
    @Override
    public Integer selectExampleListCount(Integer userId, Integer status, Integer exampleType) {
        return userDao.selectExampleListCount(userId, status, exampleType);
    }

    @Override
    public Integer insertExampleDetail(ByUserExampleDetail byUserExampleDetail) {
        return userDao.insertExampleDetail(byUserExampleDetail);
    }

    @Override
    public ByUserExampleDetail findExampleDetail(Integer id) {
        return userDao.findExampleDetail(id);
    }

    @Override
    public Integer deleteExampleDetail(Integer id) {
        return userDao.deleteExampleDetail(id);
    }

    @Override
    public List<ByUserExampleDetail> selectExampleDetailListByPage(Integer userId, Integer exampleId, Integer status, Integer start, Integer offset) {
        return userDao.selectExampleDetailListByPage(userId, exampleId, status, start, offset);
    }

    @Override
    public Integer selectExampleDetailListCount(Integer userId, Integer exampleId, Integer status) {
        return userDao.selectExampleDetailListCount(userId, exampleId, status);
    }

    @Override
    public List<User> selectBizUserListByPage(Integer productType, Integer keyId,Integer channelId, String sortBy, String styleType, String price, String keyword, Integer start, Integer offset,
                                              Integer status, String city, String area, String orderBy) {
        return userDao.selectBizUserListByPage(productType, keyId,channelId, sortBy, styleType, price, keyword, start, offset, status, city, area, orderBy);
    }

    @Override
    public Integer selectBizUserListCount(Integer productType, Integer keyId,Integer channelId, String sortBy, String styleType, String price, String keyword,
                                          Integer status, String city, String area) {
        return userDao.selectBizUserListCount(productType, keyId,channelId, sortBy, styleType, price, keyword, status, city, area);
    }

    @Override
    public Integer insertAgentCity(ByUserBizAgentCity byUserBizAgentCity) {
        return userDao.insertAgentCity(byUserBizAgentCity);
    }

    @Override
    public ByUserBizAgentCity findAgentCity(Integer id) {
        return userDao.findAgentCity(id);
    }

    @Override
    public Integer deleteAgentCity(Integer id) {
        return userDao.deleteAgentCity(id);
    }

    @Override
    public List<ByUserBizAgentCity> selectAgentCityListByPage(Integer userId, Integer start, Integer offset) {
        return userDao.selectAgentCityListByPage(userId, start, offset);
    }

    @Override
    public Integer selectAgentCityListCount(Integer userId) {
        return userDao.selectAgentCityListCount(userId);
    }

    @Override
    public Integer insertRecommendUser(ByUserRecommend byUserRecommend) {
        return userDao.insertRecommendUser(byUserRecommend);
    }

    @Override
    public ByUserRecommend findRecommendUser(Integer id) {
        return userDao.findRecommendUser(id);
    }

    @Override
    public Integer deleteRecommendUser(Integer id) {
        return userDao.deleteRecommendUser(id);
    }

    @Override
    public List<ByUserRecommend> selectRecommendUserListByPage(Integer userId, Integer status, Integer exampleId, Integer start, Integer offset) {
        return userDao.selectRecommendUserListByPage(userId, status, exampleId, start, offset);
    }

    @Override
    public Integer selectRecommendUserListCount(Integer userId, Integer status, Integer exampleId) {
        return userDao.selectRecommendUserListCount(userId, status, exampleId);
    }

    @Override
    public User selectByUserName(String userName){
        return userMapper.selectByUserName(userName);
    }

    @Override
    public List<ByOpenCity> findAllProvince(){
        return byOpenCityMapper.findAllProvince();
    }

    @Override
    public List<ByOpenCity> findAllCityByProvince(String province){
        return byOpenCityMapper.findAllCityByProvince(province);
    }

    @Override
    public List<ByOpenCity> findAllAreaByCity(String city){
        return byOpenCityMapper.findAllAreaByCity(city);
    }

    @Override
    public List<User> findAllUserFormByPage(int page,int pageNum,String cnName,String trueName,String idCard,String userName,String province,String city,String area){
        return userMapper.findAllUserFormByPage(page,pageNum,cnName,trueName,idCard,userName,province,city, area);
    }
    @Override
    public int countUserFormByPage(String cnName,String trueName,String idCard,String userName,String province,String city,String area){
        return userMapper.countUserFormByPage(cnName,trueName,idCard,userName,province,city, area);
    }

    @Override
    public List<User> findAllUserFormByPageUserType(int userType,int page,int pageNum,String cnName,String trueName,String idCard,String userName,String province,String city,String area){
        return userMapper.findAllUserFormByPageUserType(userType,page,pageNum,cnName,trueName,idCard,userName,province,city, area);
    }
    @Override
    public int countUserFormByPageUserType(int userType,String cnName,String trueName,String idCard,String userName,String province,String city,String area){
        return userMapper.countUserFormByPageUserType(userType,cnName,trueName,idCard,userName,province,city, area);
    }

    @Override
    public List<User> findUserFormByPageUserId(Integer id,int page,int pageNum,String cnName,String trueName,String idCard,String userName,String province,String city,String area){
        return userMapper.findUserFormByPageUserId(id,page,pageNum,cnName,trueName,idCard,userName,province,city, area);
    }
    @Override
    public int countUserFormByPageUserId(Integer id,String cnName,String trueName,String idCard,String userName,String province,String city,String area){
        return userMapper.countUserFormByPageUserId(id,cnName,trueName,idCard,userName,province,city, area);
    }

    @Override
    public List<User> findUserFormByPageArea(int userId,int page,int pageNum,String cnName,String trueName,String idCard,String userName,String province,String city,String areaWhere){
        return userMapper.findUserFormByPageArea(userId,page,pageNum,cnName,trueName,idCard,userName,province,city, areaWhere);
    }
    @Override
    public int countUserFormByPageArea(String area,String cnName,String trueName,String idCard,String userName,String province,String city,String areaWhere){
        return userMapper.countUserFormByPageArea(area,cnName,trueName,idCard,userName,province,city, areaWhere);
    }

    @Override
    public List<ByUserBizAuth> findByUserBizAuthByUserId(Integer userId){
        return byUserBizAuthMapper.findByUserBizAuthByUserId(userId);
    }

    @Override
    public User findUserByNamePassWord(String userName,String passWord){
        return userMapper.findUserByNamePassWord(userName,passWord);
    }

    @Override
    public User findUserByUserName(String userName){
        return userMapper.findUserByUserName(userName);
    }

    @Override
    public List<ByOpenCity> findAllListPageByWhere(String where,int page,int pageNum){
        return byOpenCityMapper.findAllListPageByWhere(where,page,pageNum);
    }

    @Override
    public int countAllListPageByWhere(String where){
        return byOpenCityMapper.countAllListPageByWhere(where);
    }

    @Override
    public int insertSelectiveCity(ByOpenCity byOpenCity){
        return byOpenCityMapper.insertSelective(byOpenCity);
    }

    @Override
    public int updateByPrimaryKeySelectiveCity(ByOpenCity byOpenCity){
        return byOpenCityMapper.updateByPrimaryKeySelective(byOpenCity);
    }

    @Override
    public ByOpenCity findByProvinceCityArea(String province,String city,String area){
        return byOpenCityMapper.findByProvinceCityArea(province,city,area);
    }

    @Override
    public int deleteOpenCityByPrimaryKey(Integer id){
        return byOpenCityMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<ByOpenCity> findAllListByWhere(int userId,String where){
        return byOpenCityMapper.findAllListByWhere(userId,where);
    }

    @Override
    public int insertRoleOpenCity(int userId,int openId){
        return byOpenCityMapper.insertRoleOpenCity(userId,openId);
    }

    @Override
    public int deleteRoleOpenCityByRoleId(int userId){
        return byOpenCityMapper.deleteRoleOpenCityByRoleId(userId);
    }

    @Override
    public int deleteRoleOpenCityByOpenCityId(int openCityId){
        return byOpenCityMapper.deleteRoleOpenCityByOpenCityId(openCityId);
    }

    @Override
    public List<ByOpenCity> findAllUserListPageByWhere(int userId,String where,int page,int pageNum){
        return byOpenCityMapper.findAllUserListPageByWhere(userId,where,page,pageNum);
    }

    @Override
    public int countAllUesrListPageByWhere(int userId,String where){
        return byOpenCityMapper.countAllUesrListPageByWhere(userId,where);
    }

    @Override
    public int insertUserOpenCity(ByOpenCity record){
        return byOpenCityMapper.insertUserOpenCity(record);
    }

    @Override
    public int deleteUserOpenCityByRoleId(int userId){
        return byOpenCityMapper.deleteUserOpenCityByRoleId(userId);
    }

    @Override
    public ByOpenCity findByUserIdProvinceCityArea(String province,String city,String area,int userId){
        return byOpenCityMapper.findByUserIdProvinceCityArea(province,city,area,userId);
    }

    @Override
    public List<ByOpenCity> findUserCityByUserId(int userId){
        return byOpenCityMapper.findUserCityByUserId(userId);
    }

    @Override
    public int deleteUserOpenCityById(int id){
        return byOpenCityMapper.deleteUserOpenCityById(id);
    }

    @Override
    public List<ByOpenCity> findAllProvinceCityListByWhere(String where){
        return byOpenCityMapper.findAllProvinceCityListByWhere(where);
    }

    @Override
    public List<User> findAllUserFormByStatusPage(int status,String username,int page,int pageNum){
        return userMapper.findAllUserFormByStatusPage(status,username,page,pageNum);
    }

    @Override
    public int countUserFormByStatusPage(int status,String username){
        return userMapper.countUserFormByStatusPage(status,username);
    }

    @Override
    public List<ByUserRecommendBvo> selectByUserRecommendBvoListByPage(Integer userId, Integer status, Integer exampleId,RequestPage page) {
        return userDao.selectByUserRecommendBvoListByPage(userId,status,exampleId,page);
    }

    @Override
    public int insertIntoUserChannel(int userId,int channelId){
        return userMapper.insertIntoUserChannel(userId,channelId);
    }

    @Override
    public int deleteUserChannelByUserId(int userId){
        return userMapper.deleteUserChannelByUserId(userId);
    }

    @Override
    public int deleteUserChannelByChannelId(int channelId){
        return userMapper.deleteUserChannelByChannelId(channelId);
    }

    @Override
    public List<User> findAllUserFormByChannelId(int channelId){
        return userMapper.findAllUserFormByChannelId(channelId);
    }

    @Override
    public List<ByChannelKeyword> findAllByChannelKeywordByUserChannel(String username){
        return byChannelKeywordMapper.findAllByChannelKeywordByUserChannel(username);
    }

    @Override
    public int insertIntoRescRole(int rescId,int roleId){
        return rescMapper.insertIntoRescRole(rescId,roleId);
    }

    @Override
    public int deleteRescRoleByRescId(int rescId){
        return rescMapper.deleteRescRoleByRescId(rescId);
    }

    @Override
    public int deleteRescRoleByRoleId(int roleId){
        return rescMapper.deleteRescRoleByRoleId(roleId);
    }

    @Override
    public List<Resc> findAllRescByRoleIdFromUserId(int userId,int roleId){
        return rescMapper.findAllRescByRoleIdFromUserId(userId,roleId);
    }

    @Override
    public Integer deleteByExampleBudgetKey(Integer id) {
        return userDao.deleteByExampleBudgetKey(id);
    }

    @Override
    public ByExampleBudget selectByExampleBudgetKey(Integer id) {
        return userDao.selectByExampleBudgetKey(id);
    }

    @Override
    public Integer insertExampleBudget(ByExampleBudget record) {
        return userDao.insertExampleBudget(record);
    }

    @Override
    public Integer updateByExampleBudgetKey(ByExampleBudget byExampleBudget) {
        return userDao.updateByExampleBudgetKey(byExampleBudget);
    }

    @Override
    public List<ByExampleBudget> selectExampleBudgetListByPage(Integer exampleId, RequestPage page) {
        return userDao.selectExampleBudgetListByPage(exampleId,page);
    }

    @Override
    public Integer deleteByExampleDiscussKey(Integer id) {
        return userDao.deleteByExampleDiscussKey(id);
    }

    @Override
    public ByExampleDiscuss selectByExampleDiscussKey(Integer id) {
        return userDao.selectByExampleDiscussKey(id);
    }

    @Override
    public Integer insertExampleDiscuss(ByExampleDiscuss record) {
        return userDao.insertExampleDiscuss(record);
    }

    @Override
    public Integer updateByExampleDiscussKey(ByExampleDiscuss byExampleDiscuss) {
        return userDao.updateByExampleDiscussKey(byExampleDiscuss);
    }

    @Override
    public List<ByExampleDiscuss> selectExampleDiscussListByPage(Integer exampleId, RequestPage page) {
        return userDao.selectExampleDiscussListByPage(exampleId,page);
    }

    @Override
    public List<ByUserRecommend> findAllRecommendByUserIdPage(int userId,int page,int pageNum){
        return byUserRecommendMapper.findAllRecommendByUserIdPage(userId,page,pageNum);
    }

    @Override
    public ByUserRecommend findByUserRecommendByUserIdRecommendId(int userId,int recommendId){
        return byUserRecommendMapper.findByUserRecommendByUserIdRecommendId(userId,recommendId);
    }

    @Override
    public int countRecommendByUserIdPage(int userId){
        return byUserRecommendMapper.countRecommendByUserIdPage(userId);
    }

    @Override
    public int insertSelectiveRecommend(ByUserRecommend byUserRecommend){
        return byUserRecommendMapper.insertSelective(byUserRecommend);
    }

    @Override
    public int updateByPrimaryKeySelectiveRecommend(ByUserRecommend byUserRecommend){
        return byUserRecommendMapper.updateByPrimaryKeySelective(byUserRecommend);
    }

    @Override
    public int deleteByPrimaryKeyRecommed(int id){
        return byUserRecommendMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<User> findAllUserByAreaType(String area,int userType){
        return userMapper.findAllUserByAreaType(area,userType);
    }

    @Override
    public List<User> findAllUserByArea(String area){
        return userMapper.findAllUserByArea(area);
    }

    @Override
    public List<User> findAllUserListByMobileStatusPage(int status,String mobile,int page,int pageNum){
        return userMapper.findAllUserListByMobileStatusPage(status,mobile,page,pageNum);
    }

    @Override
    public int countUserListByMobileStatusPage(int status,String mobile){
        return userMapper.countUserListByMobileStatusPage(status,mobile);
    }

    @Override
    public List<ByUserBizAuth> findUserBizAuthByUserId(int userId) {
        return userDao.findUserBizAuthByUserId(userId);
    }

    @Override
    public List<User> findAllUserRecommendByUserId(int userId){
        return userMapper.findAllUserRecommendByUserId(userId);
    }

    @Override
    public List<User> findAllUserChannelByUserId(int channelId,int page,int pageNum){
        return userMapper.findAllUserChannelByUserId(channelId,page,pageNum);
    }

    @Override
    public int countUserChannelByUserId(int channelId){
        return userMapper.countUserChannelByUserId(channelId);
    }

    @Override
    public List<AppUserList> findAllUserChannelByUserIdAPP(String area,String startPrice,String endPrice,String wedding,String order,int page,int pageNum,String roleType,String cnName,String channelIds){
        return userMapper.findAllUserChannelByUserIdAPP(area,startPrice,endPrice,wedding,order,page,pageNum,roleType,cnName,channelIds);
    }

    @Override
    public int countUserChannelByUserIdAPP(String area,String startPrice,String endPrice,String wedding,String order,String roleType,String cnName,String channelIds){
        return userMapper.countUserChannelByUserIdAPP(area,startPrice,endPrice,wedding,order,roleType,cnName,channelIds);
    }



    @Override
    public List<ByOpenCity> findAllCityByUserId(int userId){
        return byOpenCityMapper.findAllCityByUserId(userId);
    }

    @Override
    public List<ByOpenCity> findAllAreaByUserId(int userId){
        return byOpenCityMapper.findAllAreaByUserId(userId);
    }

    @Override
    public List<ByOpenCity> findOpenCityByUserId(int userId) {
        return byOpenCityMapper.findOpenCityByUserId(userId);
    }

    @Override
    public Integer deleteByDictKey(Integer id) {
        return userDao.deleteByDictKey(id);
    }

    @Override
    public Dict selectByDictKey(Integer id) {
        return userDao.selectByDictKey(id);
    }

    @Override
    public Integer insertDict(Dict record) {
        return userDao.insertDict(record);
    }

    @Override
    public Integer updateByDictKey(Dict dict) {
        return userDao.updateByDictKey(dict);
    }

    @Override
    public List<Dict> selectDictListByPage(Integer type, RequestPage page) {
        return userDao.selectDictListByPage(type,page);
    }

    @Override
    public List<ByOpenCity> findAreaByCity(String city){
        return byOpenCityMapper.findAreaByCity(city);
    }

    @Override
    public int insertIntoUserFollow(int userId,int followUserId,int type,int status){
        return userMapper.insertIntoUserFollow(userId,followUserId,type,status);
    }

    @Override
    public int deleteUserFollowById(int userId,int followUserId){
        return userMapper.deleteUserFollowById(userId,followUserId);
    }

    @Override
    public UserFollow findUserFollowByUserFollowUserId(int userId,int followUserId){
        return userMapper.findUserFollowByUserFollowUserId(userId,followUserId);
    }

    @Override
    public List<UserFollow> findAllUserFollowByTypeOfUser(int type,int userId, int page, int pageNum){
        return userMapper.findAllUserFollowByTypeOfUser(type,userId,page,pageNum);
    }

    @Override
    public int countUserFollowByTypeOfUser(int type,int userId){
        return userMapper.countUserFollowByTypeOfUser(type,userId);
    }

    @Override
    public List<UserFollow> findAllUserFollowByTypeOfExample(int type,int userId, int page, int pageNum){
        return userMapper.findAllUserFollowByTypeOfExample(type,userId,page,pageNum);
    }

    @Override
    public int countUserFollowByTypeOfExample(int type,int userId){
        return userMapper.countUserFollowByTypeOfExample(type,userId);
    }

    @Override
    public int countFollowByUserId(int userId){
        return userMapper.countFollowByUserId(userId);
    }

    @Override
    public int countFollowByFollowUserId(int followUserId){
        return userMapper.countFollowByFollowUserId(followUserId);
    }

    @Override
    public List<AppUserList> findAllUserList(String area,String startPrice,String endPrice,String wedding,String order, int page, int pageNum,String roleType,String cnName){
        return userMapper.findAllUserList(area,startPrice,endPrice,wedding,order,page,pageNum,roleType,cnName);
    }

    @Override
    public int countUserList(String area,String startPrice,String endPrice,String wedding,String order,String roleType,String cnName){
        return userMapper.countUserList(area,startPrice,endPrice,wedding,order,roleType,cnName);
    }

    @Override
    public int insertCard(Card card){
        return userMapper.insertCard(card);
    }

    @Override
    public int updateCardById(Card card){
        return userMapper.updateCardById(card);
    }

    @Override
    public Card findCardById(int id){
        return userMapper.findCardById(id);
    }

    @Override
    public List<Card> findAllCard(int userid){
        return userMapper.findAllCard(userid);
    }

    @Override
    public int insertCardLog(CardLog cardLog){
        return userMapper.insertCardLog(cardLog);
    }

    @Override
    public int updateCardLogById(CardLog cardLog){
        return userMapper.updateCardLogById(cardLog);
    }

    @Override
    public CardLog findCardLogById(int id){
        return userMapper.findCardLogById(id);
    }

    @Override
    public List<CardLog> findAllCardLogByCreateTime(String startTime,String endTime,String status,int userid){
        return userMapper.findAllCardLogByCreateTime(startTime,endTime,status,userid);
    }

    @Override
    public List<ByUserBizSchedule> findAllByUserIdDate(int userId,String startTime,String endTime){
        return byUserBizScheduleMapper.findAllByUserIdDate(userId,startTime,endTime);
    }

    @Override
    public int insertSchedule(Schedule schedule){
        return userMapper.insertSchedule(schedule);
    }

    @Override
    public int updateSchedule(Schedule schedule){
        return userMapper.updateSchedule(schedule);
    }

    @Override
    public Schedule findScheduleById(int id){
        return userMapper.findScheduleById(id);
    }

    @Override
    public  List<Schedule> findScheduleByWhere(String scheduledate,String scheduletime,int userid,String username){
        return userMapper.findScheduleByWhere(scheduledate,scheduletime,userid,username);
    }

    @Override
    public int deleteScheduleByid(int id){
        return userMapper.deleteScheduleByid(id);
    }

    @Override
    public Integer insertUserMessage(ByUserMessage userMessage) {
        return userDao.insertUserMessage(userMessage);
    }

    @Override
    public List<ByUserMessage> selectUserMessageByPage(Integer userId, RequestPage page) {
        return userDao.selectUserMessageByPage(userId,page);
    }

    @Override
    public Integer deleteByUserMessageKey(Integer id) {
        return userDao.deleteByUserMessageKey(id);
    }

    @Override
    public int insertUserInvitation(UserInvitation userInvitation){
        return userMapper.insertUserInvitation(userInvitation);
    }

    @Override
    public int updateUserInvitation(UserInvitation userInvitation){
        return userMapper.updateUserInvitation(userInvitation);
    }

    @Override
    public UserInvitation findUserInvitationById(int id){
        return userMapper.findUserInvitationById(id);
    }

    @Override
    public UserInvitation findUserInvitationByUserIdInvitationId(int userId,int invitationid){
        return userMapper.findUserInvitationByUserIdInvitationId(userId,invitationid);
    }

    @Override
    public int deleteUserInvitation(int id){
        return userMapper.deleteUserInvitation(id);
    }

    @Override
    public List<Invitation> findInvitation(){
        return userMapper.findInvitation();
    }

    @Override
    public Invitation findInvitaionByUserId(int userId){
        return userMapper.findInvitaionByUserId(userId);
    }

    @Override
    public Invitation findInvitationById(int id){
        return userMapper.findInvitationById(id);
    }

    @Override
    public int insertMyInvitation(MyInvitation myInvitation){
        return userMapper.insertMyInvitation(myInvitation);
    }

    @Override
    public int updateMyInvitation(MyInvitation myInvitation){
        return userMapper.updateMyInvitation(myInvitation);
    }

    @Override
    public int deleteMyInvitationById(int id){
        return userMapper.deleteMyInvitationById(id);
    }

    @Override
    public int deleteMyInvitationByUserId(int userId){
        return userMapper.deleteMyInvitationByUserId(userId);
    }

    @Override
    public List<MyInvitation> findMyInvitaiton(int userId){
        return userMapper.findMyInvitaiton(userId);
    }

    @Override
    public MyInvitation findMyInvitaitonById(int id){
        return userMapper.findMyInvitaitonById(id);
    }

    @Override
    public MyInvitation findMyInvitaitonByInvitationUser(int invitationid,int userid){
        return userMapper.findMyInvitaitonByInvitationUser(invitationid,userid);
    }

    @Override
    public User findMyPersonal(String mobile){
        return userMapper.findMyPersonal(mobile);
    }

    @Override
    public List<UserInvitation> findUserInvitaiton(int userId){
        return userMapper.findUserInvitaiton(userId);
    }

    @Override
    public int udpateStatusById(int id,int status){
        return byUserBizScheduleMapper.udpateStatusById(id,status);
    }

    @Override
    public int deleteCardById(int id){
        return userMapper.deleteCardById(id);
    }

    @Override
    public List<Card> findAllCardByUserIdPage(int userid,int page,int pageNum){
        return userMapper.findAllCardByUserIdPage(userid,page,pageNum);
    }

    @Override
    public int countCardByUserIdPage(int userid){
        return userMapper.countCardByUserIdPage(userid);
    }

    @Override
    public List<CardLog> findAllCardLogByUserIdPage(String status,int userid,int page,int pageNum){
        return userMapper.findAllCardLogByUserIdPage(status,userid,page,pageNum);
    }

    @Override
    public int countCardLogByUserIdPage(String status,int userid){
        return userMapper.countCardLogByUserIdPage(status,userid);
    }

    @Override
    public int insertSelectiveByMoneyLog(ByMoneyLog record){
        return byMoneyLogMapper.insertSelective(record);
    }

    @Override
    public List<ByMoneyLog> findAllMoneyLogByUserIdPage(Integer userId,int page,int pageNum){
        return byMoneyLogMapper.findAllMoneyLogByUserIdPage(userId,page,pageNum);
    }

    @Override
    public int countMoneyLogByUserIdPage(Integer userId){
        return byMoneyLogMapper.countMoneyLogByUserIdPage(userId);
    }
}
